drop table jms_dwd.dwd_wide_tms_road_waybill_hf;
CREATE EXTERNAL TABLE jms_dwd.dwd_wide_tms_road_waybill_hf(
  `shipment_id` bigint COMMENT '任务ID',
  `shipment_no` string COMMENT '任务编号',
  `shipment_name` string COMMENT '任务名称',
  `billcode` string COMMENT '运单号',
  `packagecode` string COMMENT '包号',
  `package_inside_charge_weight` decimal(10,4) COMMENT '内部计费重量:单位千克',
  `package_total_volume` decimal(10,4) COMMENT '包裹总体积:单位立方厘米',
  `package_total_weight` decimal(10,4) COMMENT '包裹总重量:单位千克',
  `waybill_weight` decimal(10,4) COMMENT '运单重量',
  `terminal_dispatch_code` string COMMENT '三段码',
  `start_code` string COMMENT '始发中心编号',
  `start_name` string COMMENT '始发中心名称',
  `end_code` string COMMENT '目的中心编号',
  `end_name` string COMMENT '目的中心名称',
  `shipment_site_cnt` int COMMENT '途径地数量',
  `vehicleline_id` string COMMENT '参考车线ID',
  `vehicleline_code` string COMMENT '参考车线编码',
  `vehicleline_name` string COMMENT '参考车线名称',
  `shifts` int COMMENT '班次',
  `business_attribute` int COMMENT '业务属性',
  `operation_model` string COMMENT '运行模式',
  `shipment_type` int COMMENT '任务类型',
  `shipno_planned_departure_time` timestamp COMMENT '规划发车时间',
  `shipno_planned_arrival_time` timestamp COMMENT '规划到车时间',
  `shipno_actual_departure_time` timestamp COMMENT '实际发车时间',
  `shipno_actual_arrival_time` timestamp COMMENT '实际到车时间',
  `total_runtime` timestamp COMMENT '总运行时间(MIN)',
  `total_intransittime` timestamp COMMENT '总在途时间(MIN)',
  `span_days` int COMMENT '跨越天数',
  `standard_speed` decimal(10,4) COMMENT '标准时速(KM/H)',
  `mileage` decimal(10,4) COMMENT '系统里程(KM)',
  `roadsection_id` int COMMENT '路段编号',
  `usetime` timestamp COMMENT '运输耗时(MIN)',
  `road_mileage` decimal(10,4) COMMENT '规划里程(KM)',
  `speed` decimal(10,4) COMMENT '时速(KM/H)',
  `batch_time` int COMMENT '批次时间',
  `plan_driving_time` timestamp COMMENT '规定行驶时间',
  `actual_driving_time` timestamp COMMENT '实际行驶时间',
  `estimate_batch_time` int COMMENT '应赶批次',
  `actual_batch_time` timestamp COMMENT '实赶批次时间',
  `start_site_sort_num` int COMMENT '始发站点顺序编号',
  `start_site_code` string COMMENT '始发站点编号',
  `start_site_name` string COMMENT '始发站点名称',
  `load_start_time` timestamp COMMENT '开始装货',
  `load_end_time` timestamp COMMENT '装货完成',
  `lock_time` timestamp COMMENT '锁车时间',
  `load_scan_time` timestamp COMMENT '装车扫描时间',
  `load_next_site_code` string COMMENT '装车下一站编码',
  `load_next_site_name` string COMMENT '装车下一站名称',
  `start_handling_type` string COMMENT '始发站点装卸类型',
  `send_car_scan_time` timestamp COMMENT '封发车扫描时间',
  `send_car_code` string COMMENT '封发车号',
  `app_departure_time` timestamp COMMENT 'APP离开时间',
  `gps_departure_time` timestamp COMMENT 'GPS离开时间',
  `weight_departure_time` timestamp COMMENT '过磅出站时间',
  `planned_departure_time` timestamp COMMENT '计划离开时间',
  `actual_departure_time` timestamp COMMENT '实际离开时间',
  `departure_gross_weight` decimal(10,4) COMMENT '离开毛重',
  `departure_tare_weight` decimal(10,4) COMMENT '离开皮重',
  `departure_net_weight` decimal(10,4) COMMENT '离开净重',
  `gps_depart_mileage` decimal(10,4) COMMENT 'GPS发车里程',
  `site_send_time` timestamp COMMENT '站点发件扫描',
  `send_next_site_code` string COMMENT '站点发件下一站编码',
  `send_next_site_name` string COMMENT '站点发件下一站名称',
  `end_site_sort_num` int COMMENT '目的站点顺序编号',
  `end_site_code` string COMMENT '目的站点编号',
  `end_site_name` string COMMENT '目的站点名称',
  `unload_start_time` timestamp COMMENT '开始卸货',
  `unload_end_time` timestamp COMMENT '卸货完成',
  `unlock_time` timestamp COMMENT '解锁时间',
  `unload_scan_time` timestamp COMMENT '卸车扫描时间',
  `unload_pre_site_code` string COMMENT '卸车扫描上一站编码',
  `unload_pre_site_name` string COMMENT '卸车扫描上一站名称',
  `end_handling_type` string COMMENT '目的站点装卸类型',
  `arrival_car_scan_time` timestamp COMMENT '到解车扫描时间',
  `arrival_car_code` string COMMENT '到解车号',
  `app_arrival_time` timestamp COMMENT 'APP到达时间',
  `gps_arrival_time` timestamp COMMENT 'GPS到达时间',
  `weight_arrival_time` timestamp COMMENT '过磅进站时间',
  `planned_arrival_time` timestamp COMMENT '计划到达时间',
  `actual_arrival_time` timestamp COMMENT '实际到达时间',
  `arrival_gross_weight` decimal(10,4) COMMENT '到达毛重',
  `arrival_tare_weight` decimal(10,4) COMMENT '到达皮重',
  `arrival_net_weight` decimal(10,4) COMMENT '到达净重',
  `gps_arrival_mileage` decimal(10,4) COMMENT 'GPS到车里程',
  `site_arrival_time` timestamp COMMENT '站点到件扫描',
  `arrival_pre_site_code` string COMMENT '站点到件下一站编码',
  `arrival_pre_site_name` string COMMENT '站点到件下一站名称',
  `latest_arrival_time` timestamp COMMENT '最晚到车时间',
  `estimate_arrival_time` timestamp COMMENT '预计到达时间=上一站实际发车时间+本站运输耗时(MIN)',
  `plate_number` string COMMENT '车牌号',
  `vehicletype_id` string COMMENT '车型ID',
  `vehicletype_name` string COMMENT '车型名称',
  `trailer_number` string COMMENT '挂车号',
  `carrier_id` string COMMENT '承运商ID',
  `carrier_type` string COMMENT '承运商类型',
  `carrier_name` string COMMENT '承运商全名',
  `driver_name` string COMMENT '司机名称',
  `driver_contact` string COMMENT '随车电话',
  `load_weight` decimal(10,4) COMMENT '核定质量(KG)',
  `vehicle_volume` decimal(10,4) COMMENT '核定体积（M³）',
  `nuclear_load_num` decimal(10,4) COMMENT '载票数',
  `quotation_model` string COMMENT '报价模式',
  `billing_way` int COMMENT '计费方式（1：整车计重、2：零担计重、3：按趟计费）',
  `settlement_vehicle_type_id` string COMMENT '结算车型ID',
  `settlement_vehicle_type_name` string COMMENT '结算车型名称',
  `freight_generate_status` int COMMENT '运费流水生成状态：1',
  `overtime_type` tinyint COMMENT '加班类型：11爆仓加班、12顶班、13应急加班',
  `shipment_state` int COMMENT '任务状态:待调度0',
  `is_ballast` int COMMENT '是否空放:1是',
  `is_trunk_branch` int COMMENT '支干线：1-干线；2-支线',
  `is_stop` int COMMENT '是否经停',
  `is_assist_line` int COMMENT '是否辅线',
  `vehicleline_type` int COMMENT '线路类型',
  `has_out` int COMMENT '是否兜底',
  `real_pick_network_code` string COMMENT '实际取件网点code')
COMMENT '支干线运输明细-小时表'
PARTITIONED BY (
  `dt` string COMMENT '时间分区-任务号规划发车时间')
stored as parquet
LOCATION
'/dw/hive/jms_dwd.db/external/dwd_wide_tms_road_waybill_hf'
;
msck repair table jms_dwd.dwd_wide_tms_road_waybill_hf;